package com.ruoyi.common.utils;

import com.github.binarywang.wxpay.bean.merchanttransfer.TransferCreateRequest;
import com.github.binarywang.wxpay.bean.merchanttransfer.TransferCreateResult;
import com.github.binarywang.wxpay.bean.request.WxPayOrderQueryRequest;
import com.github.binarywang.wxpay.exception.WxPayException;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import com.github.binarywang.wxpay.service.WxPayService;
@AllArgsConstructor
@Component
public class WxPayUtils {
    private final WxPayService wxService;

    /**
     发起商家转账API
     适用对象：直连商户 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_1.shtml
     请求URL：https://api.mch.weixin.qq.com/v3/transfer/batches 请求方式：POST 接口限频：
     单个商户 50QPS，如果超过频率限制，会报错FREQUENCY_LIMITED，请降低频率请求。 是否需要证书：是
     */
    public TransferCreateResult entPay(TransferCreateRequest request) throws WxPayException {
        return this.wxService.getMerchantTransferService().createTransfer(request);
    }

}
